# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
;set:
;p2 = 180 deg. X hard pulse
;p3 = 90 deg. 1H hard pulse
;p15 = contact pulse
;pl1 = to drive HP-X transmitter (CP)
;pl11 = power for 180 X pulse
;pl2 = 1H power during 90 deg. hard pulse
;pl12 = 1H power for decoupling (TPPM)
;pl22 = 1H power for CP
;l0 = 0 (first t1 incerment)
;p20 = length of 1 dumbo cyclev
;d20 not used
;d25 not used
;d26 not used
;d13 = set TD to d13*1E6
;d31 rotor period cacld. from cnst31
;p1 = 90 carbon pulse
;p2 = 180 carbon pulse
;pl11 = carbon power for pulses
;cnst31 spinning frequency in Hz
;l22 number of CPMG loops
;l30 number of rotor cycles per half echo


 
;$COMMENT= 1H-13C with shape decoupling in t1
;$CLASS=Solids
;$DIM=2D
;$TYPE=cross polarisation
;$SUBTYPE=heteronuclear correlation
# 32 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
;$OWNER=arossini


# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl" 1
;Avancesolids.incl
;   for TCU3
;
;version 1 28.2.2001, written by HF
;	   4.4.2006, complemented by Ste
# 7 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;$CLASS=Solids INCL
;$COMMENT=definitions for setrtp and setnmr

;switch between 1H or 19F output (H amplifier) 

# 14 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;gating pulse for RX, ADC and HPPR auto mode


# 18 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit blanking of preamp, receiver, adc, not implemented yet


# 26 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;generate dwell clock


;turn dwell clock on/off
# 32 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;


# 36 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;define data sampling for WAHUHA type experiments, samples analogue or digitally for d9, closes receiver


# 40 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/Avancesolids.incl"
;explicit transmitter blanking, not supported yet

;NCO switching, to be implemented

;$id: $
# 35 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr" 2
# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/trigg.incl" 1
;version (13/08/19)

;$COMMENT=definition of external trigger output, conn I pin 1
;$CLASS=Solids INCL

# 12 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/trigg.incl"
;$Id: 6u setnmr3|28 \n 4u  setnmr3^28.incl,v 1.1.18.4 2013/08/29 14:05:47 ber Exp $
# 36 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr" 2


;"in0=inf1"
"d31=1s/cnst31"
"d6=(l30*d31*2)"
"d3=(d31-(p2)/2)"
"d4=(d3-1u)"
define delay echod
"echod=(l30*d31-3u)"
;define delay setTD
;setTD=(((d6+1u+d4)+(p2+2u+d6+2*d4)*(l22-1)+(d3+2u))/dw+100)"
;"d25=1/setTD"
define delay spikesep
"spikesep=(1/(p2+2*d4+2u+d6))"
"d26=spikesep"
define delay truespikesep
"truespikesep=(1/(d6))"
define delay deadtime
"deadtime=(p2+2*d4+2u)"
"d13=1u*(((d6+1u+d4)+(p2+2u+d6+2*d4)*(l22-1)+(d3+2u))/dw+100)"
# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/rot_prot.incl" 1
;rot_prot.incl
;avance-version (13/01/29)
;Test the rf on-time and duty cycle
;protect against misset cnst31, rotation speed below 1000 Hz
;
;$CLASS=Solids INCL
;$COMMENT=protect against misset cnst31, rotation speed below 1000 Hz


1m
if "d31 < 1m" goto Passrot
2u
print "rotation period too long, cnst31 misset to less than 1000 Hz!"
goto HaltAcqu
Passrot, 1m
# 19 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/rot_prot.incl"
;$Id: rot_prot.incl,v 1.2.18.4 2013/01/29 15:40:51 ber Exp $
# 57 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr" 2


# 60 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
			;disable protection file for long acquisition change decoupling power !!! or you risk probe damage
			;if you set the label lacq (ZGOPTNS -Dlacq), the protection is disabled

# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/aq_prot.incl" 1
;aq_prot.incl
;avance-version (13/01/28)
;Test the rf on-time and duty cycle
;protect against too long acquisition time

;$CLASS=Solids INCL
;$COMMENT=protect against too long acquisition time
# 9 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/aq_prot.incl"
1m
if "aq < 50.1m" goto Passaq
2u 
print "acquisition time exceeds 50m limit!"
goto HaltAcqu
Passaq, 1m

;$Id: aq_prot.incl,v 1.2.18.4 2013/01/28 17:40:19 ber Exp $
# 63 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr" 2

			;allows max. 50 msec acquisition time, supervisor
			;may change  to max. 1s at less than 5 % duty cycle
			;and reduced decoupling field
# 1 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/p15_prot.incl" 1
;p15_prot.incl
;avance-version (13/01/29)
;Test the rf on-time and duty cycle
;protect against too long contact time
;Test the rf on-time and duty cycle 
;
;$CLASS=Solids INCL
;$COMMENT=protect against too long contact time


1m
if "p15 < 10.1m" goto Passp15
2u
print "contact time exceeds 10msec limit!"
goto HaltAcqu
Passp15, 1m
# 20 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/p15_prot.incl"
;$Id: p15_prot.incl,v 1.2.18.4 2013/01/29 15:40:51 ber Exp $
# 70 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr" 2

			;make sure p15 does not exceed 10 msec 
			;let supervisor change this pulseprogram if 
			;more is needed

# 1 "mc_line 76 file C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr exp. def. part of mc cmd. before ze"
define delay MCWRK
define delay MCREST
"MCREST = d1 - 0.500000*10m"
"MCWRK = 0.500000*10m"

    dccorr
# 76 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
# 76 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
1 ze 
# 1 "mc_line 76 file C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr exp. def. of mc cmd. after ze"
# 77 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
  d20			; delay for MAS              
# 1 "mc_line 78 file C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr exp. start label for mc cmd."
2 MCWRK do:f2
  MCREST
# 79 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
  d13
  (1u sync 1u adc ph31 syrec)
  (1u ph30:r):f1
  1u setrtp1^5
			
  (p3 ph1 pl2):f2             ; 90 degree proton pulse
;  1u
;  3 (p20:sp2 ph20):f2
;  lo to 3 times l8
;  lo to 3 times l0 

; 1u 
; (p2 ph4 pl11):f1     ;simultaneous pi pulses 
; 1u  

;4 (p20:sp2 ph20):f2
;  lo to 4 times l8
;  lo to 4 times l0 
# 99 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
;  (p11  pl2):f2
  (p15 ph2 pl1):f1 (p15:sp0 ph11):f2 ; contact pulse with ramp
  3u cpds2:f2          	
  echod
  d3                
4 (p2 pl11 ph3):f1  ;180 hard pulse for refocusing
  d4                 ; 1 rotor cycle ring down delay 
  1u setrtp1|0
  d6 setrtp1|5           ;acquire for 2*L30 rotor periods
  1u setrtp1^5
  d4
  lo to 4 times l22
  1u do:f2
  d3 
  1u setrtp1^5
  1u setrtp1^0
  rcyc=2
  1m do:f2		; decoupler off 
# 1 "mc_line 117 file C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr exp. mc cmd. in line"
  MCWRK  wr #0
  MCWRK
# 118 "C:/Bruker/TopSpin3.2_PL6/exp/stan/nmr/lists/pp/user/hetcor.shape.cpmg_v4.ajr"
HaltAcqu, 1m
exit


ph10=0
ph1=0 2 ; 1H 90 pulse
ph2=3 3 0 0 1 1 2 2 ; old cycle ph2=0    ;phases for X spin lock and pi pulse
ph3=1 1 0 0 1 1 0 0 3 3 2 2 3 3 2 2 1 1 2 2 1 1 2 2 3 3 2 2 3 3 2 2
;ph11=1
ph4=0 0 2 2
ph11=1
ph20=0
ph21=3
ph30=0
ph31=2 0 3 1 0 2 1 3 2 0 3 1 0 2 1 3 2 0 3 1 0 2 1 3 2 0 3 1 0 2 1 3 ; old cycle ph31=0 2 
